<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:icecore="http://www.icefaces.org/icefaces/core"
	xmlns:ace="http://www.icefaces.org/icefaces/components"
	xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
	<title><ice:outputLabel value="#{msgs_common.PAGE_TITLE}"></ice:outputLabel></title>
	<ice:outputStyle href="#{baseMBean.securedOutPutStyleURL}"></ice:outputStyle>
</h:head>
<h:body class="#{baseMBean.securedOutPutBodyClass}">
	<f:loadBundle
		basename="com/avecsys/quotemanager/resources/messages_supplier"
		var="msgs"></f:loadBundle>
	<f:loadBundle
		basename="com/avecsys/quotemanager/resources/messages_common"
		var="msgs_common"></f:loadBundle>
	<c:if test="${baseMBean.menuBarEnabled == 'true'}">
		<h:form id="menuBarForm">
			<icecore:singleSubmit />
			<ice:menuBar styleClass="menuBar">
		        <ice:menuItems value="#{menuBarMBean.menuModel}"/>
		    </ice:menuBar>
	    </h:form>		
	</c:if>
	<h:form id="SupplierFormID">
		<f:event listener="#{loginMBean.isUserSignedIn}" type="preRenderView"></f:event>
		<f:event listener="#{supplierMasterMBean.loadAllCountries()}"
			type="postAddToView"></f:event>
		<div class="page-container">
			<div class="pageHeader">
				<ice:panelGrid columns="2">
					<ice:graphicImage url="#{supplierMasterMBean.getImageResourceURL('PAGE_HEADER_ICON_SUPPLIER')}"></ice:graphicImage>
					<c:choose>
						<c:when test="${supplierMasterMBean.screenModeEdit == 'false'}">
							<ice:outputLabel
								value="#{msgs.SUPPLIER_FORM_NEW_HEADER_SECTION_TITLE}"
								styleClass="pageHeaderTitleText"></ice:outputLabel>
						</c:when>
						<c:otherwise>
							<ice:outputLabel
								value="#{msgs.SUPPLIER_FORM_MODIFY_HEADER_SECTION_TITLE}"
								styleClass="pageHeaderTitleText"></ice:outputLabel>
						</c:otherwise>
					</c:choose>
				</ice:panelGrid>
			</div>
			<center>
				<div>
					<ice:inputHidden
						value="#{supplierMasterMBean.supplierMasterPojo.supplierId}"
						id="supplierID"/>
					<ice:inputHidden
						value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.companyId}"
						id="companyID" />
					<ice:inputHidden id="supplierCompanyVersionID"
						value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.version}"/>
					<ice:inputHidden id="supplierVersionID"
							value="#{supplierMasterMBean.supplierMasterPojo.version}"/>
				</div>
	
				<div class="fieldsContainer">
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_COMPANY_NAME}"/>
						<span class="field">
							<ice:inputText id="companyNameId" value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.companyName}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" for="companyNameId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_ADDRESS_LINE1}"/>
						<span class="field">
							<ice:inputText id="addressLine1Id" value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.addressLine1}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="addressLine1Id"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_ADDRESS_LINE2}"/>
						<span class="field">
							<ice:inputText id="addressLine2Id" value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.addressLine2}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="addressLine2Id"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_CITY}"/>
						<span class="field">
							<ice:inputText id="cityId" value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.city}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="cityId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_COUNTRY}"/>
						<span class="field">
							<ice:selectOneMenu id="countryId"
								value="#{supplierMasterMBean.supplierMasterPojo.companyMasterPojo.countryMasterPojo.code}">
								<f:selectItems
									value="#{supplierMasterMBean.countrySelectItemList}" />
							</ice:selectOneMenu>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="countryId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_EMAIL}"/>
						<span class="field">
							<ice:inputText id="emailId"
								value="#{supplierMasterMBean.defaultAdminUserEmail}"
								required="true" immediate="true">
								<f:validator validatorId="emailValidator" />
								<f:validator validatorId="supplierEmailRegisteredCheck" />
							</ice:inputText>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="emailId"/></span>
					</div>
					<div class="field_row">
						<ice:outputLabel value="#{msgs.SUPPLIER_FORM_CONTACT_PERSON}"/>
						<span class="field">
							<ice:inputText id="contactPersonId" value="#{supplierMasterMBean.supplierMasterPojo.contactPerson}" required="true"/>
						</span> 
						<span class="fieldMessage"><ice:message styleClass="iceMsgError" style="color:red;" for="contactPersonId"/></span>
					</div>
				</div>
				<div>
					<ice:panelGrid columns="2">
						<ice:commandButton value="#{msgs.SUPPLIER_FORM_ACTION_SUBMIT}"
							action="#{supplierMasterMBean.actionSaveSupplierMaster}"
							styleClass="color green button"></ice:commandButton>
						<ice:commandButton value="#{msgs.SUPPLIER_FORM_ACTION_CANCEL}"
							immediate="true" action="#{supplierMasterMBean.actionCancel}"
							styleClass="color green button"></ice:commandButton>
					</ice:panelGrid>
				</div>
			</center>
		</div>
	</h:form>
</h:body>
</html>
